vii

vii

Contents

Preface........................................................................................................................xi

Acknowledgments....................................................................................................xiii

Author Biography.....................................................................................................xv

Introduction�����������������������������������������������������������������������������������������������������������������1

Chapter 1

What Is an Algorithm?..........................................................................5

Chapter 2

Build Your Own Game with a Simple Algorithm—​Tic Tac Toe.........13

2.1

How to Get Started....................................................................13

2.2

How to Get Warmed Up............................................................16

2.3

How to Build the Screen (UI, User Interface)..........................19

2.4

Building a “Game” from a “Widget”........................................22

2.5

Understanding the Need for an Algorithm................................28

2.6

How to Test Drive Your New Creation......................................32

2.7

Conclusion................................................................................34

Chapter 3

Explore Your Deductive Logic—​Solve a Sudoku Forever..................35

3.1

The Basic Code for solving a Sudoku.......................................38

3.2

Iterative build of CantBeList.....................................................41

3.3

Algorithms that a computer can solve better than humans.......42

3.4

3 by 3 grid interaction...............................................................45

3.5

Love-Locked Pair......................................................................49

3.6

The Golden Triangle.................................................................53

3.7

The Polyomino..........................................................................56

3.8

Matching Twins.........................................................................60

3.9

Conclusion................................................................................67

Chapter 4

Introduction to Multiplatform Integration—​Build Your

Own Remote Control..........................................................................69

4.1

Connecting the smartphone to the laptop – virtually................70

4.2

Settings in Powerpoint..............................................................71

4.3

Standard Functions...................................................................73

4.4

Reading the Googledocs input..................................................73

4.5

Taking over Keyboard Controls................................................78

4.6

Conclusion................................................................................80